package com.wuyou.simple;

import com.sun.org.apache.xpath.internal.operations.Bool;
import io.swagger.models.auth.In;
import javafx.geometry.HorizontalDirection;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * PrefixesDivBy5
 *
 * @Date 2025-11-24 11:22
 * @Author 无忧
 */
public class PrefixesDivBy5 {


    public static void main(String[] args) {
        int[] nums = {1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0};
        System.out.println(new PrefixesDivBy5().sol_1(nums));
    }

    public List<Boolean> sol_1(int[] nums) {
        int length = nums.length;
        List<Boolean> ans = new ArrayList<>();
        int originSingleDigitSum = 0;
        for (int i = 0; i < length; i++) {
            originSingleDigitSum = (originSingleDigitSum * 2) + (nums[i] == 1 ? 1 : 0);
            originSingleDigitSum %= 5;
            ans.add(originSingleDigitSum == 0);
        }
        return ans;
    }

    private int countPow(int pow) {
        if (pow == 0) return 1;
        int x = pow % 4;
        if (x == 1) return 2;
        if (x == 2) return 4;
        if (x == 3) return 8;
        if (x == 0) return 6;
        return 1;
    }
}
